<div class="panel panel-default panel-intro">
    {:build_heading()}

    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in" id="one">
                <div class="widget-body no-padding">

                    <!-- search end -->
                    <div id="toolbar" class="toolbar">
                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
                        <a href="javascript:;" onclick="createTable();"  class="btn btn-success  {:$auth->check('table_qrcode/create_qrcode')?'':'hide'}" title="{:__('create_qrcode')}" ><i class="fa fa-plus"></i> {:__('create_qrcode')}</a>

                        <a href="javascript:;" onclick = "" class="btn btn-success btn-down {:$auth->check('table_qrcode/down_qrcode')?'':'hide'}"   data-url="{:url('down_qrcode')}" title="{:__('down_qrcode')}" ><i class="fa fa-download"></i> {:__('down_qrcode')}</a>
                    </div>


                    <table id="table" class="table table-striped table-bordered table-hover" width="100%">
                    </table>
                </div>
            </div>

        </div>
    </div>
</div>
<script>

    function download( ids ){

        if( ids.length <=0 ){
            Toastr.error( '请选择要下载的内容');
            return false;

        }
        $.ajax({
            url: "{:url('down_qrcode')}",
            data: {
                ids:ids.join(",")
            },
            method:'post',
            dataType: "json",
            success: function(ret){
                if( ret.code == 1 ){
                    //Toastr.error( ret.info);
                    window.location.href = "{:url('downzip')}?zipFile=" + ret.data;
                    return false;
                } else {
                    Toastr.error( ret.info);
                    return false;
                }
                console.log(ret);
            },
            error:function(){
                Toastr.error( '网络连接失败，请稍后再试');
                return false;
            }
        });

       // window.location.href = "{:url('down_qrcode')}";
    }
    var partition_num= 50;
    function createTable() {
/*
        layer.prompt({title: '请输入要生成的数量', formType: 3}, function(num, index){

            lindex = index;
            var number = Math.ceil( num / partition_num );

            subCreate( num , number);
        });*/
        layer.open({
            type: 2,
            title: '请输入要生成的数量',
            closeBtn: true,
            shadeClose: true,
            area: ['420px', '270px'], //宽高
            content: ["{:url('create_qrcode')}", 'no'], //iframe的url，no代表不显示滚动条
        });



    }


</script>
